import static java.lang.Thread.sleep;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2025-02-17
 * Time: 9:55
 */
class MyThead extends Thread{
    @Override
    public void run() {
       while(true){
           System.out.println("Thread");
           try {
               sleep(1000);
           } catch (InterruptedException e) {
               throw new RuntimeException(e);
           }
       }
    }
}
public class Demo1 {

    public static void main(String[] args) {
        //创建一个线程
        Thread t=new MyThead();
        t.start();//开始进行线程

        while(true){
            System.out.println("Main");
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
